home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-03-06 | 1.8 KB | 66 lines | [TEXT/GEOL] |
- Item 7278104 2-Feb-90 13:38PST
-
- From: STATTENFIELD Stattenfield, Keith
-
- To: D5369 Mgmt Sys Des, Chuck McMath,PRT
- MADDEN Madden, Sue
-
- cc: MACAPP.TECH$ MacApp Technical
-
- Sub: Callbacks & MacApp Debugger
-
- Chuck & others,
-
- The problem with your callback routines is that the Pascal compiler
- is"automagically" inserting calls to a routine called "%_BP" and "%_EP" at the
- beginning and end of every procedure. It does this because MacApp source code
- uses the {$D++} command (an undocumented variant of {$D+}).
-
- Below is a sample of a completion routine from a program of my own which
- works.
-
- {$PUSH} {$S Main} {$D+}
-
- FUNCTION GetMyHConn : ConnHandle; INLINE $2028, $FFFC; { MOVE.L -4(A0),D0 }
- PROCEDURE SaveRegs; INLINE $48E7, $0F0C; { MOVEM.L D4-D7/A4/A5,-(A7) }
- PROCEDURE RestoreRegs; INLINE $4CDF, $30F0; { MOVEM.L (A7)+,D4-D7/A4/A5 }
-
- PROCEDURE CommStuffCompletionRoutine2 (hConn : ConnHandle);
- VAR
- CommunicationObject : TCommunication;
-
- BEGIN
-
- CommunicationObject := TCommunication( CMGetRefCon(hConn));
- CommunicationObject.fAsyncState := CSDone;
-
- {$IFC qCSUseStatusFile}
- CommunicationObject.fTickWhenWriteCompleted := TickCount;
- {$ENDC qCSUseStatusFile}
-
- END;
-
- (* Do some wierd stuff to keep the compiler from optimizing this
- into non-working code *)
- PROCEDURE CommStuffCompletionRoutine (hConn : ConnHandle);
- BEGIN
-
- SaveRegs;
-
- CommStuffCompletionRoutine2(hConn);
-
- RestoreRegs;
-
- END;
-
-
- {$POP}
-
-
- Put this at the very end of your source code -- I don't bother to turn {$D++}
- back on before the {$POP}, and {$POP} doesn't restore the setting.
-
- -Keith Stattenfield
- Apple Computer, Inc.
-
-